package com.woniu.entity;

import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;
import java.util.Comparator;
import java.util.TreeSet;

/**
 * @author 杨光 微信号:tolryg
 * @time 11:31
 */
@Table(name="users")
public class Users {


    public static void main(String[] args) {
        TreeSet<Students> treeSet = new TreeSet(new Comparator() {
            @Override
            public int compare(Object o1, Object o2) {
                Students u1 = (Students)o1;
                Students u2 = (Students)o2;
                return u2.getId().compareTo(u1.getId());
            }
        });
        Students s1 = new Students();
        s1.setId(68);
        Students s2 = new Students();
        s2.setId(16);
        Students s3 = new Students();
        s3.setId(6);
        Students s4 = new Students();
        s4.setId(14);
        treeSet.add(s1);
        treeSet.add(s2);
        treeSet.add(s3);
        treeSet.add(s4);
        System.out.println(treeSet);

    }

    @Id
    private Integer id;
    @Column(name = "userCode")
    private String userCode;
    @Column(name = "userPassword")
    private String userPassword;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getUserCode() {
        return userCode;
    }

    public void setUserCode(String userCode) {
        this.userCode = userCode;
    }

    public String getUserPassword() {
        return userPassword;
    }

    public void setUserPassword(String userPassword) {
        this.userPassword = userPassword;
    }

    @Override
    public String toString() {
        return "Users{" +
                "id=" + id +
                ", userCode='" + userCode + '\'' +
                ", userPassword='" + userPassword + '\'' +
                '}';
    }
}
